<!-- Gets embedded anywhere we need to list comments on a top-level commentable. We need the local variable "commentable" here. -->
<a name="comments"></a>
<div id="feedback">
	<%= flash_div :comment_error, :comment_notice -%>
	<ul class="navigation">
		
		<%- if logged_in? && (commentable.class == Chapter || CanHasBookmarks > commentable.class) -%>
			<li id="add_bookmark_link"><%= bookmark_link(commentable) %></li>			
		<%- end -%>
		<% if commentable.count_visible_comments > 0 -%>
			<li id="show_comments_link">
				<%= show_hide_comments_link(commentable) -%>
			</li>
		<% end -%>
		<li id="add_comment_link">
			<%= add_cancel_comment_link(commentable) -%>
		</li>
		
	</ul>

	<!-- if we have javascript, here is where the bookmark window will pop up -->
	<div id="dynamic-bookmark" style="display:none;">	
	</div>

	<!-- If we have javascript, here is where the Add Comment window will appear. 
		 If not, and we have params telling us to comment on this object, we will 
	     manually display the comment window. --> 
	<div id="add_comment_placeholder" style="display:none;">
	</div>

	<%- if params[:add_comment] -%>
	<div id="add_comment">
	  <%= render :partial => 'comments/comment_form', :locals => {:comment => Comment.new, :commentable => commentable, :button_name => 'Add Comment'.t}%> 		
	</div>
	<%- end -%>	

	<!-- If we have javascript, here is where the comments will be spiffily inserted -->
	<!-- If not, and show_comments is true, here is where the comments will be rendered -->
	<%- if params[:show_comments] -%>
    <div id="comments_placeholder">
		<%= render :partial => 'comments/comment_thread', :locals => { :comments => commentable.comments, :depth => 0 }%>
	<%- else -%>
    <div id="comments_placeholder" style="display: none;">
 	<%- end -%>
	</div>


	
</div>
<!-- END comments -->
